package com.theaf.basemodule.common.model;

import com.theaf.core.annotation.FieldCn;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.persistence.*;

/**
 * @Author:songwenke
 * @Description:数据扩展定义表
 * @Date:create in 14:49 2017/12/21
 * @Modified By:
 **/
@ApiModel("数据扩展定义表")
@Entity
@Table(name = "sys_data_ex_def")
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SysDataExDef {
    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.SEQUENCE,generator = "user_id_req")
    @SequenceGenerator(name = "user_id_req", sequenceName = "sys_req")
    @FieldCn(value = "id")
    private long id;
    @FieldCn(value = "所属对象")
    @Column(name = "obj")
    private String obj;
    @FieldCn(value = "字段说明")
    @Column(name = "field_tip")
    private String fieldTip;
    @FieldCn(value = "字段名")
    @Column(name = "field_name")
    private String fieldName;
    @Column(name = "field_path")
    private String fieldPath;
    @FieldCn(value = "字段类型: 1字符串2数字3日期4布尔5文件6数据字典7对象8引用9位置")
    @Column(name = "field_type")
    private int fieldType;
    @FieldCn(value = "字段格式，根据类型而定")
    @Column(name = "field_format")
    private String fieldFormat;
    @OneToOne
    @JoinColumn(name="pid")
    @FieldCn(value = "父属性，不为空时，所属对象为空")
    private SysDataExDef parent;
    @FieldCn(value = "是否标题")
    @Column(name = "is_title")
    private boolean isTitle;
    @FieldCn(value = "是否条件")
    @Column(name = "is_term")
    private boolean isTerm;
    @Column(name = "order_no")
    private int orderNo;
}
